﻿int x = 0, y = 0;
Console.SetCursorPosition(x, y);
var input = Console.ReadKey().KeyChar;
Console.WriteLine("Hello");
Console.WriteLine("点击空格来接受程序");
Console.CursorVisible = true;
Console.SetCursorPosition(x,y);
while (true)
{
    char charactor = Console.ReadKey().KeyChar;
    Console.Clear();
    Console.SetCursorPosition(x, y);
    Console.WriteLine(" ");
    switch (charactor)
    {
        case 'w':
        case 'W':
        case '8':
            y -= 1;
            if(y < 0)
                y = 0;
            Console.SetCursorPosition(x, y);
            Console.WriteLine("Hello");
            break;
        case 'a':
        case 'A':
        case '4':
            x -= 1;
            if (x < 0)
                x = 0;
            Console.SetCursorPosition(x, y);
            Console.WriteLine("Hello");
            break;
        case 's':
            case 'S':
        case '2':
            y += 1;
            if (y < 0)  
                y=0;
            Console.SetCursorPosition(x, y);
            Console.WriteLine("Hello");
            break;
        case 'd':
        case 'D':
        case '6':
            x += 1;
            if (x < 0)
                x=0;
         Console.SetCursorPosition (x, y);
            Console.WriteLine("Hello");
            break ;
        case ' ':
            Console.WriteLine("结束程序");
            System.Environment.Exit(1);
            break;
        default:
            break;
    }
}
